<template>
    <div class="error-page">
        <AppError :data="props.data" @logout="logout" @btn-click="btnClick"></AppError>
    </div>
    
</template>

<script setup>
import { AppError } from '@yanxiu/app-error';
import { useStore } from 'vuex';
import { pageJump } from '@/global/location-transfer';


const store = useStore();

const props = defineProps({
    data: {
        type: Object,
        default: () => {
            return {
                // code: 0,
                // title: '',
                // message: '页面出错了~',
                // buttonLabel: '返回首页',
                // target: '/idx/home'
            };
        }
    }
})

function logout() {
    store.dispatch('logout');
}

function btnClick(target=null) { // 默认走首页
    if (target) {
        pageJump(target);
    } else {
        // 重新加载
    }
}

</script>

<style lang="scss" scoped>
// .error-page {
//     height: 100vh;
// }
</style>
